/**
 * 选择核稿人
 * @return {}
 */
function selectHeGaoRenGridWin(){
	var _dutyname,_dutyid;
	
	var rolessm  = new Ext.grid.CheckboxSelectionModel({
		handleMouseDown:Ext.emptyFn,
		singleSelect : true,
		onMouseDown:function(e,t){
			if(t.className == 'x-grid3-row-checker x-grid3-row-radioBtn'){
				 	e.stopEvent();
		            var row = e.getTarget('.x-grid3-row');
		            if(row){
		                var index = row.rowIndex;
		                if(this.isSelected(index)){
		                    this.deselectRow(index);
		                }else{
		                    this.selectRow(index, true);
		                }
		            }
			}
		}
	});
	
	var _columnModle = new Ext.grid.ColumnModel({
		columns:[rolessm,{
			header: "姓名", sortable:true,dataIndex:'systemDuty.dutyName'
		}]
	});

	var _store = new Ext.data.JsonStore({
		fields:Ext.data.Record.create([{name:'systemDuty.dutyId',mapping:'userId'},
											{name:'systemDuty.dutyName',mapping:'userName'}
									 ]),
		url:Ext.basePath+'tjsinfo/tjsoa/xingzhengfawen/selectHeGaoList.do',
		autoLoad:true
	});
	
	var _grid = new Ext.grid.GridPanel({		
		colModel:_columnModle,		
		frame:false,
		renderTo:Ext.get('showRegional'),
		sm: rolessm,
 		store:_store,
	    anchor:'100% 100%',
	    viewConfig:{
	    	forceFit: true
	    },
	    stripeRows:true,
	    loadMask: true
	});
	
	var _win = new Ext.ux.Window({
 					title:'选择核稿人',
 					width: 500,
	    			height: 300,
 					items:[_grid]
 	}); 
 	_win.on('datatra',function(_data){ 	
		var idarray =  _data.split(",");
		_store.on('load',function(){
			for(var i =0;i<idarray.length;i++){
				if(idarray[i] != ""){
				 	var index =  this.findBy(function(_r){			 		
				 		if(_r.get('systemDuty.dutyId') == idarray[i]){
				 			return true;
				 		}			 		
				 	});
				 	rolessm.selectRow(index,true);				 			 
				}			
			}
		});		
 	});
 	_win.show();
 	
 	var _gridEl = _grid.getEl();
	_gridEl.select('div.x-grid3-hd-checker').removeClass('x-grid3-hd-checker');
	
	_store.on('load', function() { //数据加载完毕替换为checkbox列增加一个class，然后我们在这个class中修改图片
			_gridEl.select("div[class=x-grid3-row-checker]").each(function(x) {
			x.addClass('x-grid3-row-radioBtn');
		})
	});
	
	_store.on('datachanged', function() { 
			//数据加载完毕替换为checkbox列增加一个class，然后我们在这个class中修改图片
			_gridEl.select("div[class=x-grid3-row-checker]").each(function(x) {
				x.addClass('x-grid3-row-radioBtn');
			})
	});
	
 	_win.on('winsubmint',function(_win){
		var dutyid = "";
		var dutyname = "";
		var dutyarray = new Array();
		dutyarray = rolessm.getSelections();		
		for(var i = 0;i<dutyarray.length;i++)
		{
				dutyid=dutyarray[i].get('systemDuty.dutyId') ;
				dutyname=dutyarray[i].get('systemDuty.dutyName') ;
		}
		
		_win.fireEvent('tradata',{'userId':dutyid,'userName':dutyname});
		_win.close();
 	});
 	_win.on('wincancel',function(_win){
		_win.close();			
 	});
 	
 	return _win;
}